package com.kaibes.module.nacos;

import com.alibaba.nacos.api.naming.listener.Event;
import com.alibaba.nacos.api.naming.listener.NamingEvent;

public abstract class NacosZeroListener implements NacosEventListener {

    @Override
    public final void onEvent(Event event) {
        if (event instanceof NamingEvent) {
            NamingEvent namingEvent = (NamingEvent) event;
            if (namingEvent.getInstances().size() == 0) {
                onZeroInstance();
            }
        }
    }
    
    public abstract void onZeroInstance();
    
}
